﻿
<%@ Page Title="Menus" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
   CodeBehind="menus.aspx.cs" Inherits="Restaurante.menus"%>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
         <p id="titulo"> Menus </p>
    </h2>
      <div class="contTabla">
          <asp:GridView ID="gvMenus" runat="server" AutoGenerateColumns="False" 
              CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="True" 
              DataSourceID="Menu" AllowPaging="True">
              <AlternatingRowStyle BackColor="White" />
              <Columns>
                  <asp:BoundField DataField="menu" 
                      HeaderText="menu" 
                      SortExpression="menu" />
                  <asp:BoundField 
                      DataField="plato" HeaderText="plato" 
                      SortExpression="plato" />
                  <asp:BoundField DataField="bebida" HeaderText="bebida" 
                      SortExpression="bebida" />
              </Columns>
              <EditRowStyle BackColor="#2461BF" />
              <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
              <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
              <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
              <RowStyle BackColor="#EFF3FB" />
              <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
              <SortedAscendingCellStyle BackColor="#F5F7FB" />
              <SortedAscendingHeaderStyle BackColor="#6D95E1" />
              <SortedDescendingCellStyle BackColor="#E9EBEF" />
              <SortedDescendingHeaderStyle BackColor="#4870BE" />
          </asp:GridView>
          <asp:SqlDataSource ID="Menu" runat="server" 
              ConnectionString="<%$ ConnectionStrings:BarCafe %>" 
              ProviderName="<%$ ConnectionStrings:BarCafe.ProviderName %>" 
              
              SelectCommand="select m.Descripcion menu,
	   p.Descripcion plato,
	   b.Descripcion bebida
  from Menu_Precargado m,
	   plato p,
	   Bebida b
Where p.Id_Plato = m.Id_Plato
 and b.Id_Bebida = m.Id_Bebida
order by 1">
          </asp:SqlDataSource>
      </div>

      <div class="contTabla">
        <table>
        <tr>
            <td class="style1">
                <asp:Label ID="Label1" runat="server" Text="Ingrese la Descripción:"></asp:Label>
            </td>
            <td>
               <asp:TextBox ID="txbDesc" runat="server" MaxLength="50" ></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidatortxbDesc" runat="server" ErrorMessage="La descripción del menu es requerida." ControlToValidate="txbDesc"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style1">
                <asp:Label ID="Label3" runat="server" Text="Ingrese el Plato:"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlPlatos" runat="server" DataSourceID="Platos" 
                    DataTextField="Descripcion" DataValueField="Id_Plato">
                </asp:DropDownList>
                <asp:SqlDataSource ID="Platos" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BarCafe %>" 
                    ProviderName="<%$ ConnectionStrings:BarCafe.ProviderName %>" 
                    SelectCommand="SELECT Id_Plato, Descripcion FROM Plato
union
select 0, 'Seleccionar'
order by 1
">
                </asp:SqlDataSource>
                <asp:RequiredFieldValidator ID="RequiredFieldValidatorddlPlatos" runat="server" ErrorMessage="Debe seleccionar un plato." ControlToValidate="ddlPlatos"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style1">
                <asp:Label ID="Label4" runat="server" Text="Ingrese la Bebida:"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlBebidas" runat="server" DataSourceID="Bebidas" 
                    DataTextField="Descripcion" DataValueField="Id_Bebida">
                </asp:DropDownList>
                <asp:SqlDataSource ID="Bebidas" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BarCafe %>" 
                    ProviderName="<%$ ConnectionStrings:BarCafe.ProviderName %>" 
                    SelectCommand="SELECT Id_Bebida, Descripcion FROM Bebida
union
select 0, 'Seleccionar'
order by 1">
                </asp:SqlDataSource>
                <asp:RequiredFieldValidator ID="RequiredFieldValidatorddlBebidas" runat="server" ErrorMessage="Debe seleccionar una bebida." ControlToValidate="ddlBebidas"></asp:RequiredFieldValidator>
            </td>
        </tr>       
        </table>
         <br />
         <br />
        <asp:Button ID="btnAcepta" runat="server" Text="Aceptar" 
              onclick="btnAcepta_Click"/> 
            
            
        <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" 
              onclick="btnCancelar_Click"/> 
            
            
    
    </div>
    <asp:Label ID="lblError" runat="server" Text=""></asp:Label>
</asp:Content>